// TOWN SCRIPT
//    Town 7: Ephesus

// This is the special encounter script for this town.
// The states INIT_STATE, EXIT_STATE, and START_STATE have
// meanings that are described in the documentation. States you write
// yourself should be numbered from 10-100.

// flags:
// 7, 0 = entry message flag
// 7, 1 = trap flag
// 7, 2 = childs room message flag
// 7, 3 = store message flag
// 7, 4 = note flag
// 7, 5 = one time equipment give

begintownscript;

variables;

short choice;

body;

beginstate INIT_STATE;
	turn_off_training(TRUE);
	set_crime_tolerance(1);

	if (get_flag(7, 3) == TRUE) {
		set_terrain(8, 14, 19);
	}
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if (get_flag(7, 5) == FALSE) {
		set_flag(7, 5, TRUE);
		if (get_flag(101, 0) <= 12) {
			put_item_on_spot(23, 16, 286);
			put_item_on_spot(23, 16, 251);
			put_item_on_spot(23, 16, 228);
			put_item_on_spot(23, 16, 226);
			put_item_on_spot(23, 16, 225);
		}
	}
	if (get_flag(7, 0) == FALSE) {
		set_flag(7, 0, TRUE);
		reset_dialog();
		add_dialog_str(0, "The lumber town of Ephesus has been totally abandoned.", 0);
		add_dialog_str(1, "The invading hordes drove everyone away from town, leaving just thieves.", 0);
		add_dialog_str(2, "The lumber mill sits empty, gathering dust until The Wilderness is set free.", 0);
		if (get_flag(101, 0) <= 12) {
			add_dialog_str(3, "It appears one of the thieves lost their loot, right in the middle of the path.", 0);
		}
		add_dialog_choice(0, "Ok");
		choice = run_dialog(TRUE);
	}
break;

beginstate 10;
	if (get_flag(7, 2) == FALSE) {
		set_flag(7, 2, TRUE);
		reset_dialog();
		add_dialog_str(0, "As you enter the room, you kick a small toy laying on the floor.", 0);
		add_dialog_str(1, "It starts to make noise, some sort of song, that is hard to make out.", 0);
		add_dialog_str(2, "'Are you ready kids' then garbage, then 'who lives in a pineapple under the sea'.", 0);
		add_dialog_str(3, "You can't quite make out the chorus, but you think it's something to do with 'bob'.", 0);
		add_dialog_str(4, "The toy continues and you can make out 'absorbent and yellow and porous is he'.", 0);
		add_dialog_str(5, "The rest of the song talks about 'nautical nonsense be something you wish' and something about 'flop on the deck and plop like a fish'.", 0);
		add_dialog_choice(0, "Continue");
		choice = run_dialog(TRUE);
		reset_dialog();
		add_dialog_str(0, "The unintelligible chorus goes for a while, then the yellow, sponge-like toy stops.", 0);
		add_dialog_str(1, "The silence is a blessing.", 0);
		add_dialog_str(2, "A poster on the west wall catches your eye.", 0);
		add_dialog_choice(0, "Ok");
		choice = run_dialog(TRUE);
	}
break;

beginstate 11;
	large_draw_pic_dialog(560, "The poster is a picture of a colorful character signed 'bob', perhaps the object of the toy's song?");
	set_flag(51, 8, TRUE);
break;

beginstate 12;
	if (get_flag(7, 3) == FALSE) {
		set_flag(7, 3, TRUE);
		message_dialog("This appears to be where the thieves store items stolen until ready to sell.",
			"You also hear a light click from the wall to the east.");
		play_sound(9);
		set_terrain(8, 14, 19);
	}
break;

beginstate 13;
	if (get_flag(7, 4) == FALSE) {
		set_flag(7, 4, TRUE);
		add_dialog_str(0, "You kick up a faded note on the floor.", 0);
		add_dialog_str(1, "It reads: 'Zanta follower infested children's play cave.'", 0);
		add_dialog_str(2, "It ends with 'Must keep children away until cleared.'", 0);
		add_dialog_str(3, "There's no indication if the infestation was ever cleared.", 0);
		add_dialog_choice(0, "Ok");
		choice = run_dialog(TRUE);
	}
break;
